﻿using System.Globalization;
using System.IO;

namespace Z.GenerateIconProject.WinForm
{
    public partial class IconLibraryHelper
    {
        public static string GetIconName(FileInfo file)
        {
            string fileName = file.Name;
            TextInfo textInfo = new CultureInfo("en-US", false).TextInfo;

            string name = fileName.Split('.')[0];
            string suffixe = "";
            if (name.EndsWith("_"))
            {
                suffixe = "_";
            }
            name = textInfo.ToTitleCase(name.Replace("_", " ").Replace(")", " ").Replace("(", " ")).Replace(" ", "").Replace("-", "");
            if (char.IsNumber(name[0]))
            {
                name = "_" + name;
            }
            return name + suffixe;
        }
    }
}